package by.gravity.billprinter.utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import by.gravity.billprinter.R;

public class DialogHelper {

	public interface OnPositiveButtonClickListener {

		public void onPositiveButtonClicked();
	}

	public static void showConfirmDialog(Activity activity, int title, int message, final OnPositiveButtonClickListener onPositiveButtonClickListener) {

		AlertDialog.Builder adb = new AlertDialog.Builder(activity);

		adb.setTitle(title);

		adb.setMessage(message);

		adb.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {

				if (onPositiveButtonClickListener != null) {
					onPositiveButtonClickListener.onPositiveButtonClicked();
				}
			}
		});

		adb.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog, int which) {

				dialog.dismiss();
			}
		});
		adb.show();

	}
}
